/* 表格组件样式 */

/* 表格容器 */
.table-container {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 基础表格 */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* 表头 */
.table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
  padding: 1rem;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.table th.sortable:hover {
  background: #e9ecef;
}

.table th.sortable::after {
  content: '↕';
  position: absolute;
  right: 0.5rem;
  opacity: 0.5;
}

.table th.sortable.asc::after {
  content: '↑';
  opacity: 1;
}

.table th.sortable.desc::after {
  content: '↓';
  opacity: 1;
}

/* 表格行 */
.table td {
  padding: 1rem;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #f8f9fa;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* 表格行状态 */
.table tbody tr.selected {
  background: #e3f2fd;
}

.table tbody tr.error {
  background: #ffebee;
}

.table tbody tr.success {
  background: #e8f5e8;
}

.table tbody tr.warning {
  background: #fff3e0;
}

/* 表格单元格内容 */
.table-cell-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-cell-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

/* 状态徽章 */
.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  display: inline-block;
  min-width: 60px;
}

.status-badge.enabled,
.status-badge.active,
.status-badge.published,
.status-badge.success {
  background: #d4edda;
  color: #155724;
}

.status-badge.disabled,
.status-badge.inactive,
.status-badge.draft,
.status-badge.warning {
  background: #fff3cd;
  color: #856404;
}

.status-badge.archived,
.status-badge.error,
.status-badge.danger {
  background: #f8d7da;
  color: #721c24;
}

.status-badge.admin {
  background: #d1ecf1;
  color: #0c5460;
}

.status-badge.user {
  background: #e2e3e5;
  color: #383d41;
}

/* 表格分页 */
.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.pagination-info {
  font-size: 0.9rem;
  color: #666;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pagination-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid #dee2e6;
  background: white;
  color: #333;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #007bff;
}

.pagination-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* 表格加载状态 */
.table-loading {
  position: relative;
}

.table-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-loading::before {
  content: '加载中...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #007bff;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* 空状态 */
.table-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.table-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.table-empty-text {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.table-empty-subtext {
  font-size: 0.9rem;
  color: #999;
}

/* 响应式表格 */
@media (max-width: 768px) {
  .table-container {
    overflow-x: auto;
  }
  
  .table {
    min-width: 600px;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .table-cell-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .table-cell-actions .btn {
    width: 100%;
    margin-left: 0;
  }
  
  .table-pagination {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .pagination-controls {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
  }
  
  .status-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    min-width: 50px;
  }
}
